import { PluginOption } from 'vite'
export const ele_plus_dev = (env: Record<string, string>): PluginOption => {
  // 开发环境完整引入element-plus
  return {
    name: 'dev-auto-import-element-plus',
    transform(code, id) {
      if (env.VITE_USER_NODE_ENV !== 'production' && /src\/main.ts$/.test(id)) {
        return {
          code: `${code};import ElementPlus from 'element-plus';import 'element-plus/dist/index.css';app.use(ElementPlus);`,
          map: null
        }
      }
    }
  }
}
